﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace WebApplication2
{
    public partial class ThankYou : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // Retrieve all the users in the database
            // select * from Users

            string connectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=SampleDB;Integrated Security=True";

            SqlConnection connection = new SqlConnection(connectionString);
            connection.Open();

            SqlCommand command = new SqlCommand();
            command.Connection = connection;
            command.CommandText = "select * from Users";

            // command.ExecuteNonQuery(); // INSERT, UPDATE, DELETE
            // command.ExecuteScalar(); // ONE SINGLE RTURN VALUE

            SqlDataAdapter adapter = new SqlDataAdapter(command);

            DataSet ds = new DataSet();

            adapter.Fill(ds);

            // Display all the users in the grid

            grdUsers.DataSource = ds;
            grdUsers.DataBind();
        }
    }
}